# -*- coding: utf-8 -*-
# @File     : models.py
# @Author   : bingjia
# @Time     : 2020/8/7 10:09
# @Desc     :

from django.db import models
from django.utils.translation import ugettext_lazy as _

from ..utils.choices import SERVICE_TYPE


class LeasePlatform(models.Model):
    """
    租赁平台
    """


class LeaseService(models.Model):
    """
    租赁服务
    """
    "服务名字"
    service_name = models.CharField(max_length=250, null=False, blank=False, verbose_name=_("service name"))
    "服务类型"
    service_type = models.CharField(max_length=32, null=False, blank=False, choices=SERVICE_TYPE,
                                    verbose_name=_("service type"))
    "服务收费"
    service_price = models.DecimalField(max_digits=16, decimal_places=2, verbose_name=_("service price"))
    "服务描述"
    service_description = models.TextField(null=False, blank=False, verbose_name=_("service description"))
    "创建时间"
    created_date = models.DateTimeField(auto_now_add=True, verbose_name=_("create date"))

    class Meta:
        verbose_name = "租赁服务"
        verbose_name_plural = "租赁服务"

    def __str__(self):
        return self.service_name


class LeaseModel(models.Model):
    """
    租赁模型
    """
    model = models.ForeignKey("trains.ModelInfo", blank=False, null=True, on_delete=models.CASCADE,
                              verbose_name=_("model"))
    "模型收费"
    service_price = models.DecimalField(max_digits=16, decimal_places=2, verbose_name=_("service price"))
    "模型描述"
    service_description = models.TextField(null=False, blank=False, verbose_name=_("service description"))

    class Meta:
        verbose_name = "租赁模型"
        verbose_name_plural = "租赁模型"

